<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="./css/aui.2.0.css" />
    <style type="text/css">
        html,body {
            height: 100%;
        }
        header {
            padding: 2.5rem 0.5rem 2rem 0.5rem;
        }
    </style>
</head>
<body>
    <header class="aui-bar aui-bar-nav">
        <div class="aui-title"></div>
    </header>
    <footer class="aui-bar aui-bar-tab">
        <div class="aui-bar-tab-item aui-active" tapmode>
            <i class="aui-iconfont aui-icon-home"></i>
            <div class="aui-bar-tab-label">首页</div>
        </div>
        <div class="aui-bar-tab-item" tapmode>
            <i class="aui-iconfont aui-icon-star"></i>
            <div class="aui-bar-tab-label">收藏</div>
        </div>
        <div class="aui-bar-tab-item" tapmode>
            <div class="aui-badge">99</div>
            <i class="aui-iconfont aui-icon-cart"></i>
            <div class="aui-bar-tab-label">购物车</div>
        </div>
        <div class="aui-bar-tab-item" tapmode>
            <div class="aui-dot"></div>
            <i class="aui-iconfont aui-icon-my"></i>
            <div class="aui-bar-tab-label">我的</div>
        </div>
    </footer>
</body>
<script type="text/javascript" src="./script/api.js" ></script>
<script type="text/javascript" src="./script/jquery/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="./script/aui-tab.js" ></script>
<script type="text/javascript">
    var _frames = [{
        name: 'media_list_frm',
        url: './html/media_list_frm.html',
        bgColor: '#fff',
        navColor: '#039be5',
        navText: '视频',
        barStyle: 'light'
    },{
        name: 'demo_news_today_frm',
        url: './html/demo_news_today_frm.html',
        bgColor: '#fff',
        navColor: '#e74c3c',
        navText: '今日头条',
        barStyle: 'light'
    },{
        name: 'demo_wechat_circle_frm',
        url: './html/demo_wechat_circle_frm.html',
        bgColor: '#fff',
        navColor: '#37363b',
        navText: '朋友圈',
        barStyle: 'light'
    },{
        name: 'demo_zhihu_frm',
        url: './html/demo_zhihu_frm.html',
        bgColor: '#fff',
        navColor: '#039be5',
        navText: '知乎',
        barStyle: 'light'
    }];
    apiready = function(){
        api.parseTapmode();
        $api.fixStatusBar($api.dom('header'));
        api.openFrameGroup({
            name: 'main_frm_group',
            background: '#fff',
            scrollEnabled: false,
            rect: {
                x: 0,
                y: $api.offset($api.dom('header')).h,
                w: 'auto',
                h: $api.offset($api.dom('body')).h - $api.offset($api.dom('header')).h - $api.offset($api.dom('footer')).h
            },
            index: 0,
            frames: _frames
        }, function(ret, err) {
            setHeader(ret.index);
        });

    }
    var tab = new auiTab({
        element: $api.dom('footer')
    },function(ret){
        if(ret){
            api.setFrameGroupIndex({
                name: 'main_frm_group',
                index: ret.index - 1
            });
            setHeader(ret.index - 1);
        }
    });
    function setHeader(idx){
        api.setStatusBarStyle({
            style: _frames[idx].barStyle
        });
        $('header').css('background-color', _frames[idx].navColor);
        $('header .aui-title').html( _frames[idx].navText);
    }
</script>
</html>